export default class AddAbility2UnitOnUseAbilityState {

    static config: { [id: string]: string } = {}


    constructor() {
        let triggerHandle = CreateTrigger();
        TriggerRegisterAnyUnitEventBJ(triggerHandle, EVENT_PLAYER_UNIT_SPELL_EFFECT);
        TriggerAddAction(triggerHandle, AddAbility2UnitOnUseAbilityState.action);
    }

    static action(this: void) {
        let spellAbilityIdStr = id2string(GetSpellAbilityId());
        let cfgData = AddAbility2UnitOnUseAbilityState.config[spellAbilityIdStr];
        if (cfgData) {
            let unit = GetTriggerUnit();
            UnitAddAbility(unit, FourCC(cfgData));
        }


    }


}

